#ifndef LYH_H
#define LYH_H
#include <cuda_runtime.h>
//define
#define RESET   "\033[0m"
#define BLACK   "\033[30m"
#define RED     "\033[31m"
#define GREEN   "\033[32m"
#define YELLOW  "\033[33m"
#define BLUE    "\033[34m"
#define MAGENTA "\033[35m"
#define CYAN    "\033[36m"
#define WHITE   "\033[37m"
#define OFFSET(x,y,z) ((x) + (y) * (z))
#define CHECK(call)\
{\
  const cudaError_t error=call;\
  if(error!=cudaSuccess)\
  {\
      printf(RED "ERROR: %s:%d," ,__FILE__,__LINE__);\
      printf("code:%d,reason:%s\n" RESET,error,cudaGetErrorString(error));\
      exit(1);\
  }\
}

//todo for cuda
#include <string>
#include <vector>
#include <map>
void initDevice(int devNum);
void checkResult(float * hostRef,float * gpuRef,const int N);
void save_txt(float * result_device,int batch_size, int iy,int ix,std::string filename,bool is_device=true);
void printMatrix(float * C,const int nx,const int ny);
void printMatrix_int(int * C,const int nx,const int ny);
void initialData(float* ip,int size);
void initialData_int(int* ip, int size);
void initialData_lyh(float* fp,int size, int max_val,int min_val);
void initialData_int_lyh(int* ip, int size, int max_val, int min_val);
std::vector<float> read_temp_point(std::string filename);

// void read_h5_file(const std::string& file_path, std::vector<std::vector<float>>& list_of_points, std::vector<int>& list_of_labels);
// std::vector<std::string> get_files_in_directory(const std::string& dir);
// std::vector<float> read_param(const std::string& filepath);
// std::map<std::string, std::vector<float>> read_params(std::string dir);


//todo count_time
double cpuSecond();

#endif//LYH_H
